package workbench.VO;

public class FlagAndObject<T> {
    private T object;
    private boolean success;

    @Override
    public String toString() {
        return "FlagAndObject{" +
                "object=" + object +
                ", success=" + success +
                '}';
    }

    public T getObject() {
        return object;
    }

    public void setObject(T object) {
        this.object = object;
    }

    public boolean isSuccess() {
        return success;
    }

    public void setSuccess(boolean success) {
        this.success = success;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        FlagAndObject<?> that = (FlagAndObject<?>) o;

        if (success != that.success) return false;
        return object != null ? object.equals(that.object) : that.object == null;
    }

    @Override
    public int hashCode() {
        int result = object != null ? object.hashCode() : 0;
        result = 31 * result + (success ? 1 : 0);
        return result;
    }

    public FlagAndObject(T object, boolean success) {
        this.object = object;
        this.success = success;
    }

    public FlagAndObject() {
    }
}
